function(pistache_test test_name)
    set(TEST_EXECUTABLE run_${test_name})
    set(TEST_SOURCE ${test_name}.cc)

    add_executable(${TEST_EXECUTABLE} ${TEST_SOURCE})
    target_link_libraries(${TEST_EXECUTABLE} gtest gtest_main pistache_static curl pthread)
    add_test(${test_name} ${TEST_EXECUTABLE})
endfunction()


pistache_test(mime_test)
pistache_test(headers_test)
pistache_test(async_test)
pistache_test(typeid_test)
pistache_test(router_test)
pistache_test(cookie_test)
pistache_test(cookie_test_2)
pistache_test(cookie_test_3)
pistache_test(view_test)
pistache_test(http_parsing_test)
pistache_test(http_uri_test)
pistache_test(http_server_test)
pistache_test(http_client_test)
if (PISTACHE_ENABLE_NETWORK_TESTS)
    pistache_test(net_test)
endif (PISTACHE_ENABLE_NETWORK_TESTS)
pistache_test(listener_test)
pistache_test(request_size_test)
pistache_test(streaming_test)
pistache_test(rest_server_test)
pistache_test(string_view_test)
pistache_test(mailbox_test)
pistache_test(stream_test)
pistache_test(reactor_test)
pistache_test(threadname_test)
pistache_test(optional_test)

if (PISTACHE_USE_SSL)

    configure_file("certs/server.crt" "certs/server.crt" COPYONLY)
    configure_file("certs/server.key" "certs/server.key" COPYONLY)
    configure_file("certs/client.key" "certs/client.key" COPYONLY)
    configure_file("certs/client.crt" "certs/client.crt" COPYONLY)
    configure_file("certs/rootCA.crt" "certs/rootCA.crt" COPYONLY)

    pistache_test(https_server_test)
endif (PISTACHE_USE_SSL)

